VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Garante"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit

Private rsGarante As New ADODB.Recordset

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
''  Garante.cls
''  Implementation of the table Class Garante
''  Generated by Enterprise Architect
''  Created on:      15-Abr-2009 08:05:12 p.m.
''  Original author: Administrador
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



'Public m_PersonasTelefono As PersonasTelefono
Private m_garCodigo As Integer
Private m_garApellido As String
Private m_garNombre As String
Private m_garDomicilio As String
Private m_garDocumento As String
Private m_garTpdCodigo As Integer
Private m_garCUIT As String
Private m_garFechaNacimiento As Date
Private m_garLocalidad As String
Private m_garActividadLaboral As String
Private m_garEmpresa As String
Private m_garLegajo As String
Private m_garDomicilioEmpresa As String
Private m_garTelefonoEmpresa As String
Private m_garAntiguedadEmpleo As Integer
Private m_garSueldo As Single
Private m_garEstadoCivil As String
Private m_garNombreConyugue As String
Private m_garConyugueDocumento As String
Private m_garTipoPropiedad As String
Private m_garDomicilioPropiedad As String
Private m_garTipoTitularidad As String
Private m_garAutomotor As String
Private m_garPatenteAutomovil As String
Private m_garGrupoFamiliar As String
Private m_garReferenciasPersonales As String
Private m_garObservaciones As String
Private m_garTelefonoReferencia As String

Public Property Get garCodigo() As Integer
    garCodigo = m_garCodigo
End Property
Public Property Let garCodigo(ByVal inNew As Integer)
    If (m_garCodigo = inNew) Then Exit Property
    m_garCodigo = inNew
End Property

Public Property Get garApellido() As String
    garApellido = m_garApellido
End Property
Public Property Let garApellido(ByVal inNew As String)
    If (m_garApellido = inNew) Then Exit Property
    m_garApellido = inNew
End Property

Public Property Get garNombre() As String
    garNombre = m_garNombre
End Property
Public Property Let garNombre(ByVal inNew As String)
    If (m_garNombre = inNew) Then Exit Property
    m_garNombre = inNew
End Property

Public Property Get garDomicilio() As String
    garDomicilio = m_garDomicilio
End Property
Public Property Let garDomicilio(ByVal inNew As String)
    If (m_garDomicilio = inNew) Then Exit Property
    m_garDomicilio = inNew
End Property

Public Property Get garDocumento() As String
    garDocumento = m_garDocumento
End Property
Public Property Let garDocumento(ByVal inNew As String)
    If (m_garDocumento = inNew) Then Exit Property
    m_garDocumento = inNew
End Property

Public Property Get garTpdCodigo() As Integer
    garTpdCodigo = m_garTpdCodigo
End Property
Public Property Let garTpdCodigo(ByVal inNew As Integer)
    If (m_garTpdCodigo = inNew) Then Exit Property
    m_garTpdCodigo = inNew
End Property

Public Property Get garCUIT() As String
    garCUIT = m_garCUIT
End Property
Public Property Let garCUIT(ByVal inNew As String)
    If (m_garCUIT = inNew) Then Exit Property
    m_garCUIT = inNew
End Property

Public Property Get garFechaNacimiento() As Date
    garFechaNacimiento = m_garFechaNacimiento
End Property
Public Property Let garFechaNacimiento(ByVal inNew As Date)
    If (m_garFechaNacimiento = inNew) Then Exit Property
    m_garFechaNacimiento = inNew
End Property

Public Property Get garLocalidad() As String
    garLocalidad = m_garLocalidad
End Property
Public Property Let garLocalidad(ByVal inNew As String)
    If (m_garLocalidad = inNew) Then Exit Property
    m_garLocalidad = inNew
End Property

Public Property Get garActividadLaboral() As String
    garActividadLaboral = m_garActividadLaboral
End Property
Public Property Let garActividadLaboral(ByVal inNew As String)
    If (m_garActividadLaboral = inNew) Then Exit Property
    m_garActividadLaboral = inNew
End Property

Public Property Get garEmpresa() As String
    garEmpresa = m_garEmpresa
End Property
Public Property Let garEmpresa(ByVal inNew As String)
    If (m_garEmpresa = inNew) Then Exit Property
    m_garEmpresa = inNew
End Property

Public Property Get garLegajo() As String
    garLegajo = m_garLegajo
End Property
Public Property Let garLegajo(ByVal inNew As String)
    If (m_garLegajo = inNew) Then Exit Property
    m_garLegajo = inNew
End Property

Public Property Get garDomicilioEmpresa() As String
    garDomicilioEmpresa = m_garDomicilioEmpresa
End Property
Public Property Let garDomicilioEmpresa(ByVal inNew As String)
    If (m_garDomicilioEmpresa = inNew) Then Exit Property
    m_garDomicilioEmpresa = inNew
End Property

Public Property Get garTelefonoEmpresa() As String
    garTelefonoEmpresa = m_garTelefonoEmpresa
End Property
Public Property Let garTelefonoEmpresa(ByVal inNew As String)
    If (m_garTelefonoEmpresa = inNew) Then Exit Property
    m_garTelefonoEmpresa = inNew
End Property

Public Property Get garAntiguedadEmpleo() As Integer
    garAntiguedadEmpleo = m_garAntiguedadEmpleo
End Property
Public Property Let garAntiguedadEmpleo(ByVal inNew As Integer)
    If (m_garAntiguedadEmpleo = inNew) Then Exit Property
    m_garAntiguedadEmpleo = inNew
End Property

Public Property Get garSueldo() As Single
    garSueldo = m_garSueldo
End Property
Public Property Let garSueldo(ByVal inNew As Single)
    If (m_garSueldo = inNew) Then Exit Property
    m_garSueldo = inNew
End Property

Public Property Get garEstadoCivil() As String
    garEstadoCivil = m_garEstadoCivil
End Property
Public Property Let garEstadoCivil(ByVal inNew As String)
    If (m_garEstadoCivil = inNew) Then Exit Property
    m_garEstadoCivil = inNew
End Property

Public Property Get garNombreConyugue() As String
    garNombreConyugue = m_garNombreConyugue
End Property
Public Property Let garNombreConyugue(ByVal inNew As String)
    If (m_garNombreConyugue = inNew) Then Exit Property
    m_garNombreConyugue = inNew
End Property

Public Property Get garConyugueDocumento() As String
    garConyugueDocumento = m_garConyugueDocumento
End Property
Public Property Let garConyugueDocumento(ByVal inNew As String)
    If (m_garConyugueDocumento = inNew) Then Exit Property
    m_garConyugueDocumento = inNew
End Property

Public Property Get garTipoPropiedad() As String
    garTipoPropiedad = m_garTipoPropiedad
End Property
Public Property Let garTipoPropiedad(ByVal inNew As String)
    If (m_garTipoPropiedad = inNew) Then Exit Property
    m_garTipoPropiedad = inNew
End Property

Public Property Get garDomicilioPropiedad() As String
    garDomicilioPropiedad = m_garDomicilioPropiedad
End Property
Public Property Let garDomicilioPropiedad(ByVal inNew As String)
    If (m_garDomicilioPropiedad = inNew) Then Exit Property
    m_garDomicilioPropiedad = inNew
End Property

Public Property Get garTipoTitularidad() As String
    garTipoTitularidad = m_garTipoTitularidad
End Property
Public Property Let garTipoTitularidad(ByVal inNew As String)
    If (m_garTipoTitularidad = inNew) Then Exit Property
    m_garTipoTitularidad = inNew
End Property

Public Property Get garAutomotor() As String
    garAutomotor = m_garAutomotor
End Property
Public Property Let garAutomotor(ByVal inNew As String)
    If (m_garAutomotor = inNew) Then Exit Property
    m_garAutomotor = inNew
End Property

Public Property Get garPatenteAutomovil() As String
    garPatenteAutomovil = m_garPatenteAutomovil
End Property
Public Property Let garPatenteAutomovil(ByVal inNew As String)
    If (m_garPatenteAutomovil = inNew) Then Exit Property
    m_garPatenteAutomovil = inNew
End Property

Public Property Get garGrupoFamiliar() As String
    garGrupoFamiliar = m_garGrupoFamiliar
End Property
Public Property Let garGrupoFamiliar(ByVal inNew As String)
    If (m_garGrupoFamiliar = inNew) Then Exit Property
    m_garGrupoFamiliar = inNew
End Property

Public Property Get garReferenciasPersonales() As String
    garReferenciasPersonales = m_garReferenciasPersonales
End Property
Public Property Let garReferenciasPersonales(ByVal inNew As String)
    If (m_garReferenciasPersonales = inNew) Then Exit Property
    m_garReferenciasPersonales = inNew
End Property

Public Property Get garObservaciones() As String
    garObservaciones = m_garObservaciones
End Property
Public Property Let garObservaciones(ByVal inNew As String)
    If (m_garObservaciones = inNew) Then Exit Property
    m_garObservaciones = inNew
End Property

Public Property Get garTelefonoReferencia() As String
    garTelefonoReferencia = m_garTelefonoReferencia
End Property
Public Property Let garTelefonoReferencia(ByVal inNew As String)
    If (m_garTelefonoReferencia = inNew) Then Exit Property
    m_garTelefonoReferencia = inNew
End Property

Public Sub cargarGarante()

    On Error GoTo ErrorHandler
    
    If rsGarante.State <> adStateClosed Then
        rsGarante.Close
    End If
    
    rsGarante.Open "select * from garante ", cn, adOpenKeyset, adLockOptimistic
    m_garCodigo = rsGarante.Fields("garCodigo")
    m_garApellido = rsGarante.Fields("garApellido")
    m_garNombre = rsGarante.Fields("garNombre")
    m_garDomicilio = rsGarante.Fields("garDomicilio")
    m_garLocalidad = rsGarante.Fields("garLocalidad")
    m_garDocumento = rsGarante.Fields("garDocumento")
    m_garCUIT = rsGarante.Fields("garCUIT")
    m_garActividadLaboral = rsGarante.Fields("garActividadLaboral")
    m_garEmpresa = rsGarante.Fields("garEmpresa")
    m_garLegajo = rsGarante.Fields("garLegajo")
    m_garFechaNacimiento = rsGarante.Fields("garFechaNacimiento")
    m_garDomicilioEmpresa = rsGarante.Fields("garDomicilioEmpresa")
    m_garTelefonoEmpresa = rsGarante.Fields("garTelefonoEmpresa")
    m_garAntiguedadEmpleo = rsGarante.Fields("garAntiguedadEmpleo")
    m_garSueldo = rsGarante.Fields("garSueldo")
    m_garEstadoCivil = rsGarante.Fields("garEstadoCivil")
    m_garNombreConyugue = rsGarante.Fields("garNombreConyugue")
    m_garConyugueDocumento = rsGarante.Fields("garConyugueDocumento")
    m_garDomicilioPropiedad = rsGarante.Fields("garDomicilioPropiedad")
    m_garTipoPropiedad = rsGarante.Fields("garTipoPropiedad")
    m_garTipoTitularidad = rsGarante.Fields("garTipoTitularidad")
    m_garAutomotor = rsGarante.Fields("garAutomotor")
    m_garPatenteAutomovil = rsGarante.Fields("garPatenteAutomovil")
    m_garGrupoFamiliar = rsGarante.Fields("garGrupoFamiliar")
    m_garReferenciasPersonales = rsGarante.Fields("garReferenciasPersonales")
    m_garTelefonoReferencia = rsGarante.Fields("garTelefonoReferencia")
    m_garObservaciones = rsGarante.Fields("garObservaciones")
    m_garTpdCodigo = rsGarante.Fields("garTpdCodigo")
    
    
ErrorHandler:
    If Err <> 0 Then
        MsgBox Err.Source & "-->" & Err.Description, , "Error"
    End If
End Sub
    


Public Function crearGarante(Optional ByRef mensaje As String) As Boolean
    'If Not IsEmpty(carpaNombre) Then
    Dim strInstert As String
    
    strInstert = "insert Into garante ( garApellido, garNombre, garDomicilio, " _
        & " garDocumento, garCUIT, garActLaboral, garEmpresa, garLocalidad " _
        & " garLegajo, garFechaNacimiento, garDomicilioEmpresa, garTelefonoEmpresa, garAntiguedadEmpleo, " _
        & " garSueldo, garEstadoCivil, garNombreConyugue, garConyugueDocumento " _
        & " garDomicilioPropiedad " _
        & " garTipoPropiedad, garTipoTitularidad, garAutomovil, garPatenteAutomovil, garGrupoFamiliar" _
        & " garReferenciasPersonales, garTelReferencia, garObservaciones" _
        & " garTpdCodigo) " _
        & " values ('" & m_garApellido & "', '" & m_garNombre & "', '" _
        & m_garDomicilio & "', '" & m_garDocumento & "', '" _
        & m_garCUIT & "', '" & m_garActividadLaboral & "', '" & m_garEmpresa & "', '" & m_garLocalidad & "'" _
        & m_garLegajo & "', '" & m_garFechaNacimiento & "', '" & m_garDomicilioEmpresa & ", '" _
        & m_garTelefonoEmpresa & "', " & m_garAntiguedadEmpleo & ", " & m_garSueldo & ", '" _
        & m_garEstadoCivil & "', '" & m_garNombreConyugue & "', '" & m_garConyugueDocumento & ", '" _
        & m_garDomicilioPropiedad & "', '" & m_garTipoPropiedad & "', '" & m_garTipoTitularidad & "', '" _
        & m_garAutomotor & "', '" & m_garPatenteAutomovil & "', '" & m_garGrupoFamiliar & "', '" _
        & m_garReferenciasPersonales & "', '" & m_garTelefonoReferencia & "', '" _
        & m_garObservaciones & "', " & m_garTpdCodigo & "" _
        & ")"
    
    
    rsGarante.Open strInstert, cn, adOpenStatic, adLockPessimistic
        
        
        'If rsCarpas.Status = adStatusErrorsOccurred Then
        '    mensaje = "No pudo crease el registro"
        '    nuevaCarpa = False
        'Else
        '    rsCarpas.Close
        'End If
        mensaje = "Garante creado correctamente"
        crearGarante = True
    'Else
    '    mensaje = "El nombre de la carpa no puede ser nulo"
    '    crearCarpa = False
    'End If
    
End Function

Public Function modificarGarante(Optional ByRef mensaje As String) As Boolean
    Dim strUpdate As String
    
    strUpdate = "update garante set " _
    & " garNumero= " & m_garNumero & ", garApellido=" & m_garApellido & ", garNombre=" & m_garNombre _
    & ", garDomicilio= " & m_garDomicilio & "" _
    & ", garLocalidad=" & m_garLocalidad & ", garDocumento=" & m_garDocumento _
    & ", garCUIT=" & m_garCUIT & ", garActLaboral=" & m_garActLaboral _
    & ", garEmpresa=" & m_garEmpresa & ", garLegajo=" & m_garLegajo _
    & ", garFechaNacimiento=" & m_garFechaNacimiento & ", garDomicilioEmpresa=" & m_garDomicilioEmpresa _
    & ", garTelefonoEmpresa=" & m_garTelefonoEmpresa & ", garAntiguedadEmpleo=" & m_garAntiguedadEmpleo _
    & ", garSueldo=" & m_garSueldo & ", garEstadoCivil=" & m_garEstadoCivil _
    & ", garNombreConyugue=" & m_garNombreConyugue & ", garConyugueDocumento=" & m_garConyugueDocumento _
    & ", garDomicilioPropiedad=" & m_garDomicilioPropiedad _
    & ", garTipoPropiedad=" & m_garTipoPropiedad & ", garTipoTitularidad=" & m_garTipoTitularidad _
    & ", garAutomovil=" & m_garAutomovil & ", garPatenteAutomovil=" & m_garPatenteAutomovil _
    & ", garGrupoFamiliar=" & m_garGrupoFamiliar _
    & ", garReferenciasPersonales=" & m_garReferenciasPersonales _
    & ", garTelReferencia=" & m_garTelReferencia & ", garObservaciones=" & m_garObservaciones _
    & ", garTpdCodigo=" & m_garTpdCodigo _
    & ", garEstCodigo=" & m_garEstCodigo

    rsGarante.Open strUpdate, cn, adOpenStatic, adLockPessimistic


    If rsGarante.Status = adStatusErrorsOccurred Then
        mensaje = "No pudo modificar el registro"
        modificarGarante = False
    Else
        mensaje = "Garante modificado correctamente"
        modificarGarante = True
        
    End If
    rsGarante.Close

End Function

